package com.szcinda.fitness;

import com.szcinda.fitness.persistence.DailyTrain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.util.List;

public interface DailyTrainRepository extends JpaRepository<DailyTrain, String> {

    DailyTrain findByOpenIdAndTrainDate(String openId, LocalDate trainDate);

    @Query("select d.trainDate from DailyTrain d where d.openId =:openId order by d.trainDate")
    List<LocalDate> findTrainDayRecords(@Param("openId") String openId);
}
